﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Mapping;
using FluentNHibernate;

namespace Mindfor.Web.Data.Mappings
{
	public class FileMap : ClassMap<File>
	{
		public FileMap()
		{
			Table("Files");
			Id(m => m.Id);
			Map(m => m.Name).Length(255).Not.Nullable();
			Map(m => m.Extension).Length(20).Not.Nullable();
			Map(m => m.Size);
			Map(m => m.Loads);
			Map(m => m.CreateDate);
			Map(m => m.UpdateDate);
			Map(m => m.RecycleDate);
			Map(Reveal.Member<File>("HddId"));
			Map(Reveal.Member<File>("Data")).CustomSqlType("varbinary(max)").Length(int.MaxValue);

			References<Folder>(m => m.Folder, "FolderId");
			References<Gallery>(m => m.Gallery, "GalleryId");
		}
	}
}
